function Adminexecute() {
}

Adminexecute.execute = function(url, params, callback) {
	var xhr = new XMLHttpRequest();
	xhr.open("POST", url, true);
	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	if(params!==null){
		xhr.send(params);
	}else{
		xhr.send();
	}
	xhr.onload = function(e) {
		if (this.status == 200) {
			if (callback && typeof (callback) == "function") {
				callback(this.responseText);
			}

		}
	};
};
Adminexecute.retrieve = function(url, params, callback) {
	var xhr = new XMLHttpRequest();
	xhr.open("GET", url, true);
	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	if(params!==null){
		xhr.send(params);
	}else{
		xhr.send();
	}	
	xhr.onload = function(e) {
		if (this.status == 200) {
			if (callback && typeof (callback) == "function") {
				callback(this.responseText);
			}

		}
	};
};
Adminexecute.editCategory = function(categoryId, newCategoryName,
		callback) {
	var url = "/rest/process/edit_category";
	var params = "category_id=" + categoryId + "&new_category_name="
			+ newCategoryName;
	this.execute(url, params, callback);

};
